#include "TextReader.h"

TextReader::TextReader(tstring filename):m_FileName(filename)
{
	m_File.open(filename.c_str());
}

TextReader::~TextReader(void)
{
}

int TextReader::ParseInt(tstring& value)
{
	int result;
	tstringstream tss(value);
	tss>>result;
	return result;
}
	
float TextReader::ParseFloat(tstring& value)
{
	float result;
	tstringstream tss(value);
	tss>>result;
	return result;
}

void TextReader::ParseFloat3(tstring& value, float* x, float* y, float* z)
{
	swscanf_s(value.c_str(),L"[%f,%f,%f]",x,y,z);
}

bool TextReader::ParseBoolean(tstring& value)
{
	bool result;
	tstringstream tss(value);
	tss>>result;
	return result;
}